using UnityEngine;

public struct MHitBallAvatar
{
	public Vector3 ballPosition;

	public Vector3 ballVelocity;

	public Vector3 ballAngularVelocity;

	public Vector3 ballOptionalNormal;

	public Vector3 player1StartPosition;

	public Vector3 player1EndPosition;

	public float timeToGetToPosition;

	public float hitFlightTime;

	public Vector3 player2CurrentPosition;

	public float hitTiming;

	public float maxTiming;

	public float attackPoints;

	public float opponentDefensePoints;

	public float reductionFactor;

	public float quality;

	public float simDeltaTime;

	public bool isServe;

	public bool isBallInGame;

	public int pingTimeMs;

	public int hitType;

	public float power;

	public bool missWide;

	public float skillDifference;

	public void SetFromHitBallParamsPhysicsFlight(HitBallParamsPhysicsFlight p)
	{
		ballPosition = p.initFlightParams.position;
		ballVelocity = p.initFlightParams.velocity;
		ballAngularVelocity = p.initFlightParams.angularVelocity;
		ballOptionalNormal = p.initFlightParams.optionalNormal;
		simDeltaTime = p.simDeltaTime;
		isServe = p.isServe;
		pingTimeMs = PhotonNetwork.GetPing();
		hitType = p.hitType;
		power = p.power;
		hitTiming = p.hitTiming;
		maxTiming = p.maxTiming;
		attackPoints = p.hitParams.attackPoints;
		opponentDefensePoints = p.hitParams.opponentDefensePoints;
		reductionFactor = p.hitParams.reductionFactor;
		quality = p.hitParams.quality;
		player1StartPosition = p.movePlan.startPosition;
		player1EndPosition = p.movePlan.desiredPosition;
		timeToGetToPosition = p.movePlan.timeToGetToPosition;
		hitFlightTime = p.movePlan.hitFlightTime;
		missWide = p.missWide;
		skillDifference = p.skillDifference;
	}

	public void PrintOut()
	{
	}

	public void Send(GGNetwork network)
	{
		network.BeginWrite(13);
		network.AddVector3(ballPosition);
		network.AddVector3(ballVelocity);
		network.AddVector3(ballAngularVelocity);
		network.AddVector3(ballOptionalNormal);
		network.AddVector3(player1StartPosition);
		network.AddVector3(player1EndPosition);
		network.AddFloat(timeToGetToPosition);
		network.AddFloat(hitFlightTime);
		network.AddVector3(player2CurrentPosition);
		network.AddFloat(hitTiming);
		network.AddFloat(maxTiming);
		network.AddFloat(attackPoints);
		network.AddFloat(opponentDefensePoints);
		network.AddFloat(reductionFactor);
		network.AddFloat(quality);
		network.AddFloat(simDeltaTime);
		network.AddBool(isServe);
		network.AddBool(isBallInGame);
		network.AddInt(pingTimeMs);
		network.AddInt(hitType);
		network.AddFloat(power);
		network.AddBool(missWide);
		network.AddFloat(skillDifference);
		network.EndWrite();
		network.Send(true, 0);
	}

	public void ConvertFromRemoteToLocalSpace()
	{
		ballPosition = MultiplayerMatchController.RemoteToLocalPos(ballPosition);
		ballVelocity = MultiplayerMatchController.RemoteToLocalPos(ballVelocity);
		ballAngularVelocity = MultiplayerMatchController.RemoteToLocalPos(ballAngularVelocity);
		ballOptionalNormal = MultiplayerMatchController.RemoteToLocalPos(ballOptionalNormal);
		player1StartPosition = MultiplayerMatchController.RemoteToLocalPos(player1StartPosition);
		player1EndPosition = MultiplayerMatchController.RemoteToLocalPos(player1EndPosition);
		player2CurrentPosition = MultiplayerMatchController.RemoteToLocalPos(player2CurrentPosition);
	}

	public void Deserialize(GGNetwork network)
	{
		ballPosition = network.GetVector3();
		ballVelocity = network.GetVector3();
		ballAngularVelocity = network.GetVector3();
		ballOptionalNormal = network.GetVector3();
		player1StartPosition = network.GetVector3();
		player1EndPosition = network.GetVector3();
		timeToGetToPosition = network.GetFloat();
		hitFlightTime = network.GetFloat();
		player2CurrentPosition = network.GetVector3();
		hitTiming = network.GetFloat();
		maxTiming = network.GetFloat();
		attackPoints = network.GetFloat();
		opponentDefensePoints = network.GetFloat();
		reductionFactor = network.GetFloat();
		quality = network.GetFloat();
		simDeltaTime = network.GetFloat();
		isServe = network.GetBool();
		isBallInGame = network.GetBool();
		pingTimeMs = network.GetInt();
		hitType = network.GetInt();
		power = network.GetFloat();
		missWide = network.GetBool();
		skillDifference = network.GetFloat();
	}
}
